<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="live.jipiao.entity.AirQuery"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="live.api.impl.SanIsMember"%>
<%
	AirQuery query = (AirQuery)request.getSession().getAttribute("query");
%>
<jsp:include page="../pub_head.jsp">
	<jsp:param value="3" name="type"/>
</jsp:include>
<%@ taglib uri="/WEB-INF/tld/fn.tld" prefix="fn" %>
<%@ taglib uri="/WEB-INF/tld/core.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/WeekTab.tld" prefix="wt" %>
<%@ taglib uri="/WEB-INF/tld/PreAndNext.tld" prefix="pn" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META content="zh-cn" http-equiv="Content-Language">
<META content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>${query.fromCityName}到${query.toCityName}机票预订–国内机票预订查询服务</title>
<meta name='keywords' content='${query.fromCityName}到${query.toCityName}机票预订|${query.fromCityName}到${query.toCityName}特价机票|${query.fromCityName}到${query.toCityName}特价机票预订|${query.fromCityName}到${query.toCityName}飞机票预订|${query.fromCityName}到${query.toCityName}航班查询'/>
<meta name='description' content='机票预订频道提供${query.fromCityName}到${query.toCityName}机票预订，${query.fromCityName}到${query.toCityName}特价机票预订，${query.fromCityName}到${query.toCityName}航班查询等服务，是${query.fromCityName}到${query.toCityName}机票查询和飞机票预订的最佳渠道。'/>
<link href="/min/?b=css&amp;f=tickets.css,datepicker.css" type="text/css" rel="stylesheet" />
<script src="/min/?b=script&amp;f=j.suggest.js,flightscn.js,searchvalid.js,datepicker.js,jquery.flight.lists.js" type="text/javascript"></script>
<script src="/min/?b=script&amp;f=hotcity.js,outcitys.js,citys.js" type="text/javascript"></script>
</head>
<body>
<!--Header Begin-->
<!--Header include start-->
<!-- top 专题小头部 start -->
<!-- top 专题小头部 end -->
<!--Header include end-->
<!--Header End-->
<div class="wrapper clearfix">
  <!--Left Sidebar Begin-->
  <div class="sideLeft left">
    <div class="searchbox">
      <ul class="st">
        <li>
          <h2>机票预订</h2>
        </li>
      </ul>
      <form action="/flight/queryFlight.do?op=queryFlight" name="form0" method="get">
      <input type="hidden" name="op" value="queryFlight" />
          <ul>
            <li class="redopt">
             <input id="single_way" name="voyageType" type="radio" value="1"  />
              <span><label for="single_way">单程</label></span>
              <input id="goback_way" name="voyageType" type="radio" value="2" />
              <span><label for="goback_way">往返</label></span>
              <script type="text/javascript" defer="defer">
<!--
				$("input[name='voyageType']").each(function(i){
					var voyageType=${query.voyageType};
					if(voyageType==$(this).val()){$(this).attr("checked",true);
					}
					if(voyageType==1){$("#todate").attr("disabled",true);$("#todate").val("YYYY-MM-DD");}
				});
//-->
</script>
 			</li>
            <li class="ovs">出发城市
              <input id="cfromCity" name="fromCityName" type="text" onchange="setInputValue(this.value,this.id);"
										class="onsInput" value="${query.fromCityName}"/>
			  <input type="hidden" name="fromCity" id="fromCity"
										value="${query.fromCity}" />
            </li>
            <li class="ovs">到达城市
              <input id="ctoCity" name="toCityName" type="text" class="onsInput" onchange="setInputValue(this.value,this.id);" value="${query.toCityName}"/>
								</li>
								<input type="hidden" name="toCity" id="toCity"
									value="${query.toCity }" />
 
            <li class="ovs">出发日期
              <input id="fromdate" name="fromDate" type="text" class="onsInput datepicker" value="${query.fromDate}"/></li>
 
            <li class="ovs search_ss2" id="search_ss2">返程日期
              <input id="todate" name="toDate" type="text" class="onsInput datepicker" value="${query.toDate }"/></li>
          </ul>
		 <div class="onGray">&nbsp;</div>
          <dl class="sMore" id="qmore">
            <dt>首选舱位&nbsp;
            <input type="radio" id="cabinUsed" name="cabinUsed" value="" checked="checked"/><label for="cabinUsed">所有</label>
            &nbsp;<input type="radio" id="cabinUsed_B" name="cabinUsed" value="B"/><label for="cabinUsed_B">经济舱</label>
            </dt>
            <dd>
              <span><input type="radio" id="cabinUsed_Y" name="cabinUsed" value="Y"/>
              <label for="cabinUsed_Y">全价舱</label></span>
              <span><input name="cabinUsed" id="cabinUsed_C" type="radio" value="C" />
              <label for="cabinUsed_C">商务舱</label></span>
              <span><input type="radio" id="cabinUsed_F" name="cabinUsed" value="F" />
              <label for="cabinUsed_F">头等舱</label></span></dd>
              <script type="text/javascript" defer="defer">
              var cabinUsed='${query.cabinUsed}';
              $("input[name='cabinUsed']").each(function(){
            	 // if(cabinUsed!=''){
  					if($(this).val()==cabinUsed){$(this).attr("checked",true);}
                  //  }
              });
			</script>
          </dl>
          <div class="cxb">
          	<input type="hidden" name="backFlag" value="${query.backFlag }" id="gobackFlag"/>
          	<input type="hidden" name="voyageTypevalue" id="voyageTypevalue" value="${query.voyageType }"/>
            <input name="button" type="button" class="searchform" onclick="querySubmit0();" value="查询" />
          </div>
          <div id="searchlock" class="mloding" style="display:none">
        	</div>
        </form>
    </div>
    <div class="adtag" style="display: none">
      <div class="t">
        <h2>机票预订贴心提示</h2>
        <span><a href="/help/">更多</a></span></div>
      <ul>
        <li><a href="/help/flight/index.jsp">电子客票说明</a></li>
        <li><a href="/help/flight/help_5.jsp">如何取消订单和退票</a></li>
        <li><a href="/help/flight/help_4.jsp">如何进行在线支付</a></li>
        <li><a href="/help/flight/help_7.jsp">乘机常识</a></li>
        <li class="fys"><a href="/help/faq/f01.htm">机票预订流程演示</a></li>
      </ul>
    </div>
 
  </div>
  <!--Left Sidebar End-->
  <!--Right Sidebar Begin-->
<div class="mainlist right">
    <div class="stepout stepsearch">
      <h1>${query.fromCityName}-&gt;${query.toCityName}
      <c:if test="${query.backFlag==true && query.voyageType==2}">（往返）<span>去程</span></c:if>
      <c:if test="${query.backFlag==false && query.voyageType==2}">（往返）<span>返程</span></c:if>
      <c:if test="${query.voyageType==1}">（单程）</c:if>
      </h1>
      <ul>
        <li class="current">选择</li>
        <li>下单</li>
        <li>核对</li>
        <li>完成</li>
      </ul>
    </div>
    <!--add-->
    <c:if test="${chooseOrders!=null}">
     <div class="adiv">
      <div class="gotocit addwon">
        <div class="t"><span>◀<a href="/flight/queryFlight.do?op=queryFlight">返回上页 重选去程</a></span>
          <h2>
	      已选去程航班信息
          </h2>
        </div>
        <logic:iterate id="order" name="chooseOrders" >
        <table>
          <tr>
            <td>${order.scityName}起飞：<bean:write name="order" property="depTime" format="HH:mm"/><br/>
              到达${order.ecityName}：<bean:write name="order" property="arrTime" format="HH:mm"/></td>
            <td>${order.aircomName}</td>
            <td>舱位：<c:if test="${order.cabinInfo.level=='B'}">${order.cabinInfo.discount}折经济舱</c:if><c:if test="${order.cabinInfo.level=='Y'}">全价舱</c:if><c:if test="${order.cabinInfo.level=='F'}">头等舱</c:if>/${order.cabinInfo.level}</td>
            <td>价格：&yen;${order.cabinInfo.fare}成人（含税）</td>
          </tr>
        </table></logic:iterate>
      </div>
      <div id="adMove"></div>
    </div>
	</c:if>
    <div class="lists">
      <div class="dateopt">
        <ul>
        <wt:Tab strHref="/flight/queryFlight.do?op=queryFlight&fromCity=${query.fromCity}&voyageType=${query.voyageType }&toCity=${query.toCity}&toDate=${query.toDate}&cabinUsed=${query.cabinUsed }&backFlag=${query.backFlag }&cabinUsed=${query.cabinUsed}&fromDate=" fcn="${query.fromCityName}" tcn="${query.toCityName}" timeStr="${query.fromDate}"></wt:Tab>		
		 </ul>
      </div>
      <div class="gocit">
      <c:if test="${query.backFlag==true && query.voyageType==2}">
      <h2>选择去程</h2>
        &nbsp;&nbsp;( <span>${query.fromCityName}-&gt;${query.toCityName} &nbsp;&nbsp;${query.fromDate}出发</span> &nbsp;&nbsp;${query.toDate}返回 ) 共${fn:trim(fn:length(airData.flightList)) }个航班
      </c:if>
       <c:if test="${query.backFlag==false && query.voyageType==2}">
      <h2>选择返程</h2>
        &nbsp;&nbsp;( <span>${query.toCityName}-&gt;${query.fromCityName} &nbsp;&nbsp;${query.toDate}出发</span> ) 共${fn:trim(fn:length(airData.flightList)) }个航班
      </c:if>
      <c:if test="${query.voyageType==1}">
      <h2>选择航班</h2>
        &nbsp;&nbsp;( <span>${query.fromCityName}-&gt;${query.toCityName} &nbsp;&nbsp;${query.fromDate}出发</span> ) 共${fn:trim(fn:length(airData.flightList)) }个航班
      </c:if>
       </div>
      <div class="flilist">
        <table>
          <tr style="font-weight: bolder;">
            <th width="150px">价格</th>
            <th width="120px">机场 [时间]</th>
            <th width="140px">航空公司</th>
            <th class="row4">机建费</th>
            <th class="row5">PV值</th>
            <th></th>
          </tr>
        </table>
        <div class="flidiv">
        <c:if test="${fn:length(airData.flightList)>0}">
        <logic:iterate id="flight" name="airData" property="flightList" indexId="hb_index">
        <c:if test="${flight.cabinList[0].code!=null}">
          <table id="${airData}">
            <tr>
              <td width="150px"><em>&yen;<fmt:formatNumber value="${flight.cabinList[0].fare}" pattern="#"></fmt:formatNumber></em>&nbsp;&nbsp;&nbsp;∕ ${flight.cabinList[0].code}
                <c:if test="${fn:length(flight.cabinList)>1}"><br/>
                <a href="javascript:void(0)" id="shipTag${hb_index}" class="down">所有价格</a></c:if></td>
              <td class="row3"><p>
              ${flight.depAir }&nbsp;[<bean:write name="flight" property="depTime" format="HH:mm"/>]</p>
				<p> ${flight.arrAir }&nbsp;[<bean:write name="flight" property="arrTime" format="HH:mm"/>]</p></td>
              <td width="140px"><div><img width="16" height="16" src="flight/airpic/${flight.aircom}.gif" alt="${flight.aircom}" />${flight.aircomName}&nbsp;<B>${flight.flightNo}</B></div>
                <p>机型：<a class="tipsDiv botun" >${flight.model}</a></p></td>
              <td class="row4">¥${flight.tax}</td>
              <td class="row4" style="color: red"><fmt:formatNumber value="${flight.cabinList[0].discount/100*flight.cabinList[0].fare/7.7}" pattern="#.##"></fmt:formatNumber></td>
              <td class="center orderee">
              	<c:if test="${query.backFlag==true}">
            	<a  class="subform" id="${flight.flightNo}${flight.cabinList[0].code}"   onclick="clickup('${flight.flightNo}','${flight.cabinList[0].code}','go','/flight/queryFlight.do?op=chooseGo&fromCity=${flight.scity}&fromCityName=<%=URLEncoder.encode(query.getFromCityName(),"UTF-8") %>&voyageType=${query.voyageType}&toCity=${flight.ecity}&toCityName=<%=URLEncoder.encode(query.getToCityName(),"UTF-8") %>&todate=${query.toDate}&fromdate=${query.fromDate}&goFlightKey=${flight.flightNo}&cabinUsed=${query.cabinUsed}&cabinCode=${flight.cabinList[0].code }','0','','')">选择并查看返程</a>
            	</c:if><c:if test="${query.backFlag==false}">
            	<a class="subbtn" id="${flight.flightNo}${flight.cabinList[0].code}"  onclick="clickup('${flight.flightNo}','${flight.cabinList[0].code}','go','/flight/choose.do?fromCity=${flight.scity}&fromCityName=<%=URLEncoder.encode(query.getFromCityName(),"UTF-8") %>&voyageType=${query.voyageType}&toCity=${flight.ecity}&toCityName=<%=URLEncoder.encode(query.getToCityName(),"UTF-8") %>&todate=${query.toDate}&goFlightKey=${flight.flightNo}&cabinUsed=${query.cabinUsed}&cabinCode=${flight.cabinList[0].code }','0','','')">预订</a><br>
            	</c:if>
              </td>
               <td width="80px">
               <c:if test="${flight.cabinList[0].seat<9}">
				<p><a class="tipsDiv osb red" href="javascript:void(0)">票量紧张 ${flight.cabinList[0].seat}张</a></p>
			  </c:if>
              </td>
            </tr>
          </table>
          <div class="morediv shipTag${hb_index}" id="shipTxt${hb_index}">
          <logic:iterate id="cabin" offset="1" name="flight" property="cabinList" indexId="cabin_index" >
			<table>
              <tr>
                <td width="150px"><em>&yen;<fmt:formatNumber value="${cabin.fare}" pattern="#"></fmt:formatNumber></em><c:if test="${cabin.level=='B'}">${cabin.discount}折经济舱</c:if><c:if test="${cabin.level=='Y'}">全价舱</c:if><c:if test="${cabin.level=='F'}">头等舱</c:if>&nbsp;&nbsp;&nbsp;∕ ${cabin.code}</td>
                <td width="130px">&nbsp;</td>
                <td width="100px">&nbsp;</td>
                <td width="90px">&nbsp;</td>
               	<td style="color: red" width="40px">
               <fmt:formatNumber value="${cabin.discount/100*cabin.fare/7.7}" pattern="#.##"></fmt:formatNumber>
              </td>
                <td class="center  orderee">
                <c:if test="${query.backFlag==true}">
            	<a  class="subform" id="${flight.flightNo}${cabin.code}"   onclick="clickup('${flight.flightNo}','${cabin.code}','go','/flight/queryFlight.do?op=chooseGo&fromCity=${flight.scity}&fromCityName=<%=URLEncoder.encode(query.getFromCityName(),"UTF-8") %>&voyageType=${query.voyageType}&toCity=${flight.ecity}&toCityName=<%=URLEncoder.encode(query.getToCityName(),"UTF-8") %>&todate=${query.toDate}&fromdate=${query.fromDate }&goFlightKey=${flight.flightNo}&cabinUsed=${query.cabinUsed}&cabinCode=${cabin.code }','0','','')">选择并查看返程</a>
            	</c:if><c:if test="${query.backFlag==false}">
            	<a class="subbtn" id="${flight.flightNo}${cabin.code}"  onclick="clickup('${flight.flightNo}','${cabin.code}','go','/flight/choose.do?fromCity=${flight.scity}&fromCityName=<%=URLEncoder.encode(query.getFromCityName(),"UTF-8") %>&voyageType=${query.voyageType}&toCity=${flight.ecity}&toCityName=<%=URLEncoder.encode(query.getToCityName(),"UTF-8") %>&todate=${query.toDate}&fromdate=${query.fromDate }&goFlightKey=${flight.flightNo}&cabinUsed=${query.cabinUsed}&cabinCode=${cabin.code }','0','','')">预订</a></c:if>
            	</td>
            	 <td width="80px">
               <c:if test="${cabin.seat<9}">
				<p><a class="tipsDiv osb red" href="javascript:void(0)">票量紧张 ${cabin.seat}张</a></p>
			  </c:if>
              </td>
              </tr>
            </table>
		</logic:iterate>
          </div></c:if>
          </logic:iterate>
          </c:if>
            <c:if test="${fn:length(airData.flightList)==0}">
         <div class="errTips" style="display:">
      <p><span>非常抱歉！</span></p><p>没有找到与您选择的搜索条件${query.fromDate}从${query.fromCityName}到${query.toCityName}相符的航班。</span></p>
      <p><em>您可以尝试改变出发日期、出发城市或者到达城市等条件尝试搜索。</em></p>
      </div>
		</c:if>
          <div class="pag">
			<pn:preNext strHref="/flight/queryFlight.do?op=queryFlight&fromCity=${query.fromCity}&voyageType=${query.voyageType }&toCity=${query.toCity}&toDate=${query.toDate}&cabinUsed=${query.cabinUsed }&backFlag=${query.backFlag }&cabinUsed=${query.cabinUsed}&fromDate=" fromCityName="${query.fromCityName}" toCityName="${query.toCityName}" strTime="${query.fromDate}"/>
			</div>
        </div>
      </div>
    </div>
  </div>  
</div>
<!--Footer Begin-->
 
<!--Footer Start-->
<jsp:include page="/footer.jsp"></jsp:include>
<!--Footer End-->
 
		<div id="suggest0" class="ac_results"></div>
		<div id="suggest2" class="ac_results"></div>
		<div id="suggest3" class="ac_results"></div>
		<div id="suggest4" class="ac_results"></div>
		<div id="suggest5" class="ac_results"></div>
<!--Footer End-->
 
<script type="text/javascript"> 
   //验证机票价格
   var key;
        //调节函数
function ShowDivWin(Dtitle,DW,DH,Did)
{
	var diag = new Dialog();
	diag.Title = Dtitle;
	diag.Width = DW;
	diag.Height =DH;
	diag.InvokeElementId=Did
	diag.show();
}
function hidediv(){
Dialog.close('showDiv');
location.reload() ;
}
function clickup(flightNumber,cabinCode,gobackFlag,url,ispat,productid,fee){//,productid
 
	var i=0;
	$(".orderee").each(function(){
		if(i==0)
		{
		$("#"+flightNumber+cabinCode).replaceWith('<img height="16" width="16" src="/images/onloadingS.gif">');
		$("#"+flightNumber+cabinCode).parent().removeClass('orderee');
		}
		i++;
		var html = $(this).text();
		if($.trim(html)=="预订"){
			$(this).html('<a class="subbtned">'+html+'</a>');
			}
	/*	else if($.trim(html)=="选择并查看第二程"){
			$(this).html('<a class="subformed">'+html+'</a>');
			}
		else if($.trim(html)=="选择并查看返程"){
			$(this).html('<a class="subformed">'+html+'</a>');
			}*/
		else{
			$(this).html('<img height="16" width="16" src="/images/onloadingS.gif">');	
			}
		$(this).removeClass("subbtn");
		$(this).addClass("subbtned");
		$(this).css({"cursor":"default"});
 
	});
	if(i>0){
 
		/*if(gobackFlag=='go'){
			document.getElementById('backFlag').value=flightNumber;
		}else if(gobackFlag=='back'){
			document.getElementById('backFlightKey').value=flightNumber;
		}*/
			$("#url").val(url);
			if(productid!=""){////需要进行pat验证0//必须是特价
				//alert("ispating:"+ispat);
				pat(flightNumber,fee,cabinCode);
			}else{//不需要进行pat验证1
				//alert("nopat:"+ispat);
				startorder(url);
			}
		
		
	}
}
function startorder(url){
	window.location.href=url;
}
 
	//lowprice();
 
	$(".subbtn").css({"cursor":"pointer"});
	$(".subform").css({"cursor":"pointer"});
</script>
<div class="showDivStyle" id="showDiv" style="display:none">
	<ul>
    <li id="showcontent" class="tbig"></li>
    </ul>
</div>
</body>
</html>
